<?php

namespace common\models\shop;

use Yii;

/**
 * This is the model class for table "shop_express".
 *
 * @property integer $id
 * @property string $express_name
 * @property integer $displayorder
 * @property string $express_price
 * @property string $express_area
 * @property string $express_url
 */
class ShopExpress extends \yii\db\ActiveRecord
{

    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '物流',      //用于修改了什么的显示
        'mainfield' => 'express_name',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];


    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shop_express';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['express_name'], 'required'],
            [['express_name','express_price'], 'string', 'max' => 50],
            [['displayorder'],'integer'],
            [['displayorder'],'default','value'=>0],
            [['express_price'], 'number'],
            [['express_name'], 'string', 'max' => 50],
            [['express_area'], 'string', 'max' => 100],
            [['express_url'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'express_name' => '物流名称',
            'displayorder' => '排序',
            'express_price' => '价格',
            'express_area' => '配送区域',
            'express_url' => '官网',
        ];
    }


    public static function allArray()
    {
        return self::find()->asArray()->all();

    }

}
